def pr(h):
	print "-",' '.join(map(str,h[0]))
	print "-",' '.join(map(str,h[1]))
	print "-",' '.join(map(str,h[2]))
	print

def solve(h,s,d,n):
	if n==1:
		h[d].append(h[s].pop())
		#print "move el ",h[d][len(h[d])-1]," de ",s+1," a ",d+1
		pr(h)
	else:
		solve(h,s,3-s-d,n-1)
		h[d].append(h[s].pop())
		#print "move el ",h[d][len(h[d])-1]," de ",s+1," a ",d+1
		pr(h)
		solve(h,3-s-d,d,n-1)

h=[[3,2,1],[],[]]

pr(h)
solve(h,0,2,len(h))
